package pers.dawnyang.config.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;
import pers.dawnyang.common.enums.ResultEnum;

/**
 * 自定义业务异常
 * 
 * @author dawn yang
 * 
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BusinessException extends RuntimeException {
  private static final long serialVersionUID = 1L;
  private String msg;
  private int code = -1;

  public BusinessException() {

  }

  public BusinessException(String msg) {
    this.msg = msg;
  }

  public BusinessException(String msg, int code) {
    this.msg = msg;
    this.code = code;
  }

  public BusinessException(ResultEnum re) {
    this.msg = re.getMsg();
    this.code = re.getCode();
  }

}
